package jwlee.testxml;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class StudentVO {

	private String className;// 所在班级

	private String name;// 姓名

	private Integer age;// 年龄

	private String sex;// 性别，M男F女

	private String gradeMath;// 数学等级

	private String gradeChinese;// 语文等级

	private Calendar birthday;// 生日

	public String getGradeChinese() {
		return gradeChinese;
	}

	public void setGradeChinese(String gradeChinese) {
		this.gradeChinese = gradeChinese;
	}

	public String getGradeMath() {
		return gradeMath;
	}

	public void setGradeMath(String gradeMath) {
		this.gradeMath = gradeMath;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Override
	public String toString() {
		Field[] fields = this.getClass().getDeclaredFields();
		StringBuffer buffer = new StringBuffer(this.getClass().getName() + "[");
		for (int i = 0; i < fields.length; i++) {
			String type = fields[i].getType().getName();
			Object value = null;
			try {
				value = fields[i].get(this);
			} catch (Exception e) {
				e.printStackTrace();
			}
			if (value instanceof Calendar) {
				value = (new SimpleDateFormat("yyyy-MM-dd")).format(((Calendar) value).getTime());
			}
			buffer.append(fields[i].getName() + ":" + value + "; ");
		}
		buffer.append("]");
		return buffer.toString();
	}

	public Calendar getBirthday() {
		return birthday;
	}

	public void setBirthday(Calendar birthday) {
		this.birthday = birthday;
	}
}
